﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="HosKPIItem.aspx.cs" Inherits="KPI_SYSTEM.KPIPage.HosKPIItem" %>

<!DOCTYPE html>
<html>
<head runat="server">
    <title></title>
    <link rel="stylesheet" href="../res/third-party/jqueryuiautocomplete/jquery-ui.css" />
    <style>
       
    </style>
</head>
<body style="overflow: -Scroll; overflow-x: hidden">

    <form id="form1" runat="server">
        <f:PageManager ID="PageManager1" runat="server" />
        <f:Form ID="Form2" IsFluid="true" CssClass="blockpanel" BodyPadding="5 5 0 5" LabelAlign="Left" ShowHeader="false"
            Title="查询" runat="server">
            <Rows>
                <f:FormRow ColumnWidths="15% 15% 15% 15% 15% 15%">
                    <Items>
                        <f:TextBox runat="server" ID="tbxNameSerach" Label="指标名称"></f:TextBox>
                        <f:DropDownList ID="ddlSearchKPI_ITEM_TYPE" Width="150px" Label="指标类别" AutoSelectFirstItem="true" runat="server">
                        </f:DropDownList>
                        <f:Button ID="btnSearch" Text="搜索" Icon="Magnifier" runat="server" OnClick="btnSearch_Click"></f:Button>

                    </Items>
                    <Items>
                    </Items>
                </f:FormRow>
            </Rows>
        </f:Form>
        <f:Panel ID="Panel16" ShowHeader="false" CssClass="" ShowBorder="false" Layout="VBox" runat="server" AutoScroll="true">
            <Items>
                <f:Grid ID="Grid1" IsFluid="true" CssClass="blockpanel" ShowBorder="true" ShowHeader="true" Width="400px" EnableCollapse="false"
                    runat="server" DataKeyNames="REC_ID" AllowCellEditing="false" PageSize="15" AllowPaging="true" OnRowCommand="Grid1_RowCommand" OnPreRowDataBound="Grid1_PreRowDataBound"
                    DataIDField="REC_ID" Title="指标项目列表">
                    <Toolbars>
                        <f:Toolbar ID="Toolbar2" Position="Top" runat="server">
                            <Items>
                                <f:Button ID="btnNew" Text="新增" Icon="Add" EnablePostBack="false" runat="server">
                                    <Listeners>
                                        <f:Listener Event="click" Handler="onNewButtonClick" />
                                    </Listeners>
                                </f:Button>
                                <f:Button ID="btnExport" Text="导出" Icon="ApplicationGo" DisableControlBeforePostBack="false"
                                    runat="server" EnableAjax="false" OnClick="btnExport_Click">
                                </f:Button>
                                <f:Button ID="btnImport" Text="导入" Icon="ApplicationGet" runat="server"></f:Button>
                            </Items>
                        </f:Toolbar>
                    </Toolbars>
                    <Columns>
                        <f:RenderField Width="150px" ColumnID="KPI_ITEM_NAME" DataField="KPI_ITEM_NAME"
                            HeaderText="指标名称">
                        </f:RenderField>
                        <f:RenderField Width="150px" ColumnID="KPI_ITEM_SCORE" DataField="KPI_ITEM_SCORE"
                            HeaderText="指标分值">
                        </f:RenderField>
                        <f:RenderField Width="150px" ColumnID="KPI_ITEM_TYPE_NAME" DataField="KPI_ITEM_TYPE_NAME"
                            HeaderText="指标类别">
                        </f:RenderField>
                         <f:RenderField Width="150px" ColumnID="KPI_ITEM_DEPT_TYPE_NAME" DataField="KPI_ITEM_DEPT_TYPE_NAME"
                            HeaderText="适用科室">
                        </f:RenderField>
                        <f:RenderField Width="300px" ColumnID="KPI_ITEM_EXPLAIN" DataField="KPI_ITEM_EXPLAIN"
                            HeaderText="指标释义">
                        </f:RenderField>
                        <f:RenderField Width="150px" ColumnID="KPI_ITEM_REMARK" DataField="KPI_ITEM_REMARK"
                            HeaderText="指标备注">
                        </f:RenderField>
                        <f:RenderField Width="150px" ColumnID="KPI_ITEM_STATUS_NAME" DataField="KPI_ITEM_STATUS_NAME"
                            HeaderText="指标状态">
                        </f:RenderField>
                        <f:RenderField Width="150px" Hidden="true" ColumnID="KPI_ITEM_TYPE" DataField="KPI_ITEM_TYPE"
                            HeaderText="指标类别ID">
                        </f:RenderField>
                        <f:RenderField Width="150px" Hidden="true" ColumnID="KPI_ITEM_STATUS" DataField="KPI_ITEM_STATUS"
                            HeaderText="指标状态ID">
                        </f:RenderField>
                         <f:RenderField Width="150px" Hidden="true" ColumnID="KPI_ITEM_DEPT_TYPE" DataField="KPI_ITEM_DEPT_TYPE"
                            HeaderText="适用科室类别ID">
                        </f:RenderField>
                        <f:LinkButtonField ColumnID="Edit" Width="50px" EnablePostBack="true" Icon="Pencil" />
                        <f:LinkButtonField Width="50px" ConfirmText="删除选中行？" ConfirmTarget="Top"
                            CommandName="Delete" Icon="Delete" />
                    </Columns>
                </f:Grid>

            </Items>
        </f:Panel>
        <f:Window ID="Window1" Title="新增考核指标" Hidden="true" EnableIFrame="false" AutoScroll="true"
            EnableMaximize="true" Target="Self" EnableResize="true" runat="server"
            IsModal="true" Width="650px">
            <Items>
                <f:SimpleForm ID="SimpleForm1" runat="server" ShowBorder="false" ShowHeader="false" BodyPadding="10px">
                    <Items>
                        <f:Panel ID="Panel1" ShowHeader="false" CssClass="" ShowBorder="false" Layout="Column" runat="server">
                            <Items>
                                <f:HiddenField ID="hfFormID" runat="server"></f:HiddenField>
                                <f:TextBox ID="tbxFormKPI_ITEM_NAME" runat="server" Width="310px" CssClass="marginr" Label="指标名称" ShowRedStar="true" Required="true">
                                </f:TextBox>
                                <f:TextBox ID="tbxFormKPI_ITEM_SCORE" runat="server" Width="310px" MarginLeft="20px" CssClass="marginr" Label="指标分值" ShowRedStar="true" Required="true">
                                </f:TextBox>
                            </Items>
                        </f:Panel>
                    </Items>
                    <Items>
                        <f:Panel ID="Panel2" ShowHeader="false" CssClass="" ShowBorder="false" Layout="Column" runat="server">
                            <Items>
                                <f:DropDownList ID="ddlFormKPI_ITEM_TYPE" Width="310px" Label="指标类别" AutoSelectFirstItem="true" runat="server">
                                </f:DropDownList>
                                <f:DropDownList ID="ddlFormKPI_ITEM_STATUS" Width="310px" MarginLeft="20px" Label="指标状态" AutoSelectFirstItem="true" runat="server">
                                    <f:ListItem Text="启用" Value="1" />
                                    <f:ListItem Text="停用" Value="0" />
                                </f:DropDownList>
                            </Items>
                        </f:Panel>
                    </Items>
                     <Items>
                        <f:Panel ID="Panel5" ShowHeader="false" CssClass="" ShowBorder="false" Layout="Column" runat="server">
                            <Items>
                                <f:DropDownList ID="ddlFormKPI_ITEM_DEPT_TYPE" Width="310px"  Label="适用科室" AutoSelectFirstItem="true" runat="server">
                                </f:DropDownList>
                            </Items>
                        </f:Panel>
                    </Items>
                    <Items>
                        <f:Panel ID="Panel3" ShowHeader="false" CssClass="" ShowBorder="false" Layout="Column" runat="server">
                            <Items>
                                <f:TextBox ID="tbxFormKPI_ITEM_EXPLAIN" runat="server"  CssClass="marginr" Label="指标释义">
                                </f:TextBox>
                            </Items>
                        </f:Panel>
                    </Items>
                    <Items>
                        <f:Panel ID="Panel4" ShowHeader="false" CssClass="" ShowBorder="false" Layout="Column" runat="server">
                            <Items>
                                <f:TextBox ID="tbxFormKPI_ITEM_REMARK" runat="server"  CssClass="marginr" Label="指标备注">
                                </f:TextBox>
                            </Items>
                        </f:Panel>
                    </Items>
                    <Toolbars>
                        <f:Toolbar ID="Toolbar1" Position="Bottom" ToolbarAlign="Right" runat="server">
                            <Items>
                                <f:Button ID="btnSave"
                                    Icon="SystemSave" runat="server" Text="保存" ValidateForms="SimpleForm1" OnClick="btnSave_Click">
                                </f:Button>
                            </Items>
                        </f:Toolbar>
                    </Toolbars>
                </f:SimpleForm>
            </Items>
        </f:Window>
        <br />
        <br />
        <br />
    </form>
    <script src="../res/js/ApprovalButton.js"></script>
    <script>
        var windowClientID = '<%= Window1.ClientID %>';
        var gridClientID = '<%= Grid1.ClientID %>';
        var btnSaveClientID = '<%= btnSave.ClientID %>';
        var formClientID = '<%= SimpleForm1.ClientID %>';
        var hfFormIDClientID = '<%= hfFormID.ClientID %>';
        var tbxFormKPI_ITEM_NAMEClientID = '<%= tbxFormKPI_ITEM_NAME.ClientID %>';
        var tbxFormKPI_ITEM_SCOREClientID = '<%= tbxFormKPI_ITEM_SCORE.ClientID %>';
        var ddlFormKPI_ITEM_TYPEClientID = '<%= ddlFormKPI_ITEM_TYPE.ClientID %>';
        var ddlFormKPI_ITEM_STATUSClientID = '<%= ddlFormKPI_ITEM_STATUS.ClientID %>';
        var tbxFormKPI_ITEM_EXPLAINClientID = '<%= tbxFormKPI_ITEM_EXPLAIN.ClientID %>';
        var tbxFormKPI_ITEM_REMARKClientID = '<%= tbxFormKPI_ITEM_REMARK.ClientID %>';
        var ddlFormKPI_ITEM_DEPT_TYPEClientID = '<%= ddlFormKPI_ITEM_DEPT_TYPE.ClientID %>';
        

        function onNewButtonClick(event) {
            // 重置表单字段
            F(formClientID).reset();
            F(hfFormIDClientID).setValue(null);
            // 弹出窗体
            F(windowClientID).show();
            F(windowClientID).setTitle('新增数据');
        }
        function onEditButtonClick(event) {
            showEditWindow();
        }
        function showEditWindow(rowId) {
            var grid = F(gridClientID);

            // 如果传入参数为空，则获取当前选中行
            if (!rowId) {
                var selectedRowIds = grid.getSelectedRows();
                if (!selectedRowIds.length) {
                    F.alert('请至少选择一项！');
                    return;
                }

                rowId = selectedRowIds[0];
            }
            F(windowClientID).setTitle('编辑数据');
            // 当前行数据
            var rowValue = grid.getRowValue(rowId);
            // 使用当前行数据填充表单字段
            F(hfFormIDClientID).setValue(rowId);
            F(tbxFormKPI_ITEM_NAMEClientID).setValue(rowValue['KPI_ITEM_NAME']);
            F(tbxFormKPI_ITEM_SCOREClientID).setValue(rowValue['KPI_ITEM_SCORE']);
            F(ddlFormKPI_ITEM_TYPEClientID).setValue(rowValue['KPI_ITEM_TYPE']);
            F(ddlFormKPI_ITEM_STATUSClientID).setValue(rowValue['KPI_ITEM_STATUS']);
            F(tbxFormKPI_ITEM_EXPLAINClientID).setValue(rowValue['KPI_ITEM_EXPLAIN']);
            F(tbxFormKPI_ITEM_REMARKClientID).setValue(rowValue['KPI_ITEM_REMARK']);
            F(ddlFormKPI_ITEM_DEPT_TYPEClientID).setValue(rowValue['KPI_ITEM_DEPT_TYPE']);

            
            // 弹出新增窗体
            F(windowClientID).show();
        }
    </script>
</body>
</html>
